home *** CD-ROM | disk | FTP | other *** search
/ The Best of MacTutor - S…e Code for Volumes 1 to 5 / The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin / Source Code / #23 (Aug 87) / library manager source / Lib Mgr Demo next >
Text File  |  1987-07-13  |  2KB  |  84 lines

  1. PROGRAM LibMgrDemo;
  2. {$I-        Lightspeed Compiler Command}
  3.  
  4.     USES
  5.         LibMgr;
  6.  
  7.     VAR
  8.         TopFile : LmirHdl;
  9.  
  10.     PROCEDURE InitThings;
  11.     BEGIN
  12.  
  13.         InitGraf(@thePort);          {create a grafport for the screen}
  14.  
  15.         MoreMasters;
  16.         MoreMasters;
  17.         MoreMasters;
  18.  
  19.         InitFonts;
  20.         InitWindows;
  21.         InitMenus;
  22.         TEInit;
  23.         InitDialogs(NIL);
  24.         FlushEvents(everyEvent, 0);
  25.         InitCursor;
  26.     END;
  27.  
  28.     PROCEDURE SetUpThings;
  29.     BEGIN
  30.         OpenLib(TopFile, 'Application Default Library'); {When program boots}
  31.         OpenLinkedLib(TopFile, 'User Default Library'); {When program boots}
  32.     END;
  33.  
  34.     PROCEDURE DisplayMsg2;
  35.         VAR
  36.             p1, p2, p3, p4 : str80;
  37.             status : ARRAY[0..3] OF str80;
  38.             x : integer;
  39.     BEGIN
  40.         Status[0] := 'Open';
  41.         Status[1] := 'Closed';
  42.         Status[3] := 'Not Found';
  43.  
  44.         x := Ord(TopFile^^.status);
  45.         p1 := Concat(TopFile^^.filename, ' is ', Status[x], '.  ');
  46.         x := Ord(TopFile^^.next^^.status);
  47.         p2 := Concat(TopFile^^.next^^.filename, ' is ', Status[x], '.  ');
  48.         p3 := '                                                               ';
  49.         p4 := 'Would you like a nice cool glass of lemonade?  ';
  50.         ParamText(p1, p2, p3, p4);
  51.         x := CautionAlert(301, NIL);
  52.  
  53.     END;
  54.  
  55.     PROCEDURE DisplayMsg;
  56.         VAR
  57.             next : LmirHdl;
  58.             newRect : Rect;
  59.     BEGIN
  60.         SetRect(newRect, 80, 40, 430, 200);
  61.         SetTextRect(newRect);
  62.         ShowText;
  63.         next := TopFile;
  64.         REPEAT
  65.             writeln('   The File ', next^^.filename, ' is ', next^^.status);
  66.             next := next^^.next;
  67.         UNTIL next = topfile;
  68.         Writeln('   Press mouse button to close files and exit');
  69.         WHILE NOT button DO
  70.             ;
  71.     END;
  72.  
  73.     PROCEDURE CloseThings;
  74.  
  75.     BEGIN
  76.         CloseLibList(TopFile);
  77.     END;
  78.  
  79. BEGIN
  80.     InitThings;
  81.     SetUpThings;
  82.     DisplayMsg;
  83.     CloseThings;
  84. END.